package com.market.quote.modules.stock.infrastructure.db.converter;

import com.market.quote.modules.stock.domain.dto.StockInfoDTO;
import com.market.quote.modules.stock.infrastructure.db.model.Stock;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * @author duweibin
 * @date 2024/4/22
 * @description 数据库对象与DTO转换器
 */
@Mapper(componentModel = "spring")
public interface StockConverter {

    /**
     * stock info to stock info dto
     * @param stock stock info
     * @return  stock info dto
     */
    StockInfoDTO toStockInfoDTO(Stock stock);

    /**
     * stock info to stock info dto
     * @param stockList stock info list
     * @return  stock info dto
     */
    List<StockInfoDTO> toStockInfoDTO(List<Stock> stockList);

    /**
     * stock info dto to stock
     * @param stockInfoDTO stock info dto
     * @return stock info
     */
    Stock toStock(StockInfoDTO stockInfoDTO);

    /**
     * stock info dto list to stock info list
     * @param stockInfoDTOList stock info dto list
     * @return  stock info list
     */
    List<Stock> toStock(List<StockInfoDTO> stockInfoDTOList);
}
